<script lang="ts" setup>
import { reactive, ref, onMounted } from 'vue';
import { useRouter } from 'vue-router';
import { Icon } from '/@/components/Icon';
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
const HTML: any = ref(null);
const Routervalue:any = useRouter()
const html = Routervalue.currentRoute.value.query.body
const Header = decodeURI(Routervalue.currentRoute.value.query.data);
const data: any = reactive({
  searchValue: '',
  show: false,
  spinning: true,
});
onMounted(() => {
  if (HTML.value.innerText) {
    data.spinning = false;
  } else {
    data.spinning = true;
  }
});
function click() {
  data.searchValue = '';
  data.show = !data.show;
}
</script>

<template>
  <a-spin class="example" :delay="800" :spinning="data.spinning">
    <div>
      <!-- 1 -->
      <div id="layout-header">
        <div class="site-logo">
          <img src="./img/site-logo.svg" alt="" />
          <p class="site-name">Gblog</p>
        </div>
        <div class="menu-item header-search">
          <div class="header-search">
            <Icon @click.stop="click" icon="ant-design:search-outlined"></Icon>
            <input ref="searchInput" :class="{ show: data.show }" type="text" />
          </div>
        </div>
      </div>
      <!-- 1 -->

      <!-- 2 -->
      <div class="articles">
        <div class="site-content animate">
          <div class="site-main">
            <div class="hentry">
              <!-- 文章头部 -->
              <header class="entry-header">
                <!-- 标题输出 -->
                <h1 class="entry-title" style="font-size: 23px; font-weight: 600; color: #737373; margin: 0.67em 0">{{
                    Header
                }}</h1>
                <hr />
                <div class="breadcrumbs">
                  <div id="crumbs" style="font-size: 14px; color: #d2d2d2">2020年04月21日</div>
                </div>
              </header>

              <!-- 正文输出 -->
              <div class="entry-content" style="letter-spacing: 6px"  ref="HTML" v-html="html">
              </div>
              <!--评论-->
              <div class="comments"> </div>
            </div>
          </div>
        </div>
      </div>
      <!-- 2 -->
    </div>
  </a-spin>
</template>

<style scoped lang="less">
@keyframes main {
  0% {
    opacity: 0;
    transform: translateY(50px);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 800px) {
  .site-content {
    animation: none;
    padding: 50px 4% 0 4%;
  }
}

@media (max-width: 800px) {

  .entry-content ul,
  .entry-content ol {
    padding-left: 10px;
    margin: 0;
  }

  .entry-content ul li,
  .entry-content ol li {
    list-style: inside;
    margin: 0;
  }
}

html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  display: block;
}

body {
  line-height: 1;
  overflow-x: hidden;
}

ol,
ul {
  list-style: none;
}

blockquote,
q {
  quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
  content: '';
  content: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

/*包含以下四种的链接*/
a,
a:link,
a:visited,
a:hover,
a:active {
  text-decoration: none;
  color: unset;
}

* {
  font-family: miranafont, 'Hiragino Sans GB', STXihei, 'Microsoft YaHei', SimSun, sans-serif;
  margin: 0;
  padding: 0;
  text-decoration: none;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: 1px;
}

[v-cloak] {
  display: none;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-thumb {
  border-radius: 10px;
  background-color: #d81e06;
}

::-webkit-scrollbar-track {
  background-color: #ffffff;
}

.site-content {
  margin: 0 auto;
  padding: 0 10px;
  max-width: 800px;
}

.animate {
  animation: main 1.5s;
}

/**文章样式**/
.entry-content {
  /* BLOCKS
  =============================================================================*/
  /* HEADERS
  =============================================================================*/
  /* LINKS
  =============================================================================*/
  /* LISTS
  =============================================================================*/
  /* CODE
  =============================================================================*/
  /* QUOTES
  =============================================================================*/
  /* HORIZONTAL RULES
  =============================================================================*/
  /* TABLES
  =============================================================================*/
  /* IMAGES
  =============================================================================*/
  /* P
  =============================================================================*/
  /**
  =============================================================================*/
}

.entry-content p,
.entry-content blockquote,
.entry-content ul,
.entry-content ol,
.entry-content dl,
.entry-content table,
.entry-content pre {
  margin: 15px 0;
}

.entry-content h1,
.entry-content h2,
.entry-content h3,
.entry-content h4,
.entry-content h5,
.entry-content h6 {
  color: #4f4f4f;
  margin: 8px 0 16px;
  font-weight: 700;
  position: relative;
}

.entry-content h1:hover:before,
.entry-content h2:hover:before,
.entry-content h3:hover:before,
.entry-content h4:hover:before,
.entry-content h5:hover:before,
.entry-content h6:hover:before {
  left: -28px;
  position: absolute;
  content: '「 ';
  color: #ff6d6d;
}

.entry-content h1:hover:after,
.entry-content h2:hover:after,
.entry-content h3:hover:after,
.entry-content h4:hover:after,
.entry-content h5:hover:after,
.entry-content h6:hover:after {
  content: ' 」';
  color: #ff6d6d;
}

.entry-content h1 tt,
.entry-content h1 code,
.entry-content h2 tt,
.entry-content h2 code,
.entry-content h3 tt,
.entry-content h3 code,
.entry-content h4 tt,
.entry-content h4 code,
.entry-content h5 tt,
.entry-content h5 code,
.entry-content h6 tt,
.entry-content h6 code {
  font-size: inherit;
}

.entry-content h1 {
  font-size: 28px;
  line-height: 36px;
}

.entry-content h2 {
  font-size: 24px;
  line-height: 32px;
}

.entry-content h3 {
  font-size: 22px;
  line-height: 30px;
}

.entry-content h4 {
  font-size: 20px;
  line-height: 28px;
}

.entry-content h5 {
  font-size: 18px;
  line-height: 26px;
}

.entry-content h6 {
  font-size: 16px;
  line-height: 24px;
}

.entry-content a {
  color: #6795b5;
  text-decoration: none;
}

.entry-content a:active,
.entry-content a:hover {
  outline: 0;
}

.entry-content a:hover,
.entry-content a:focus {
  color: #cb4b16;
  text-decoration: none;
}

.entry-content ul,
.entry-content ol {
  padding-left: 30px;
}

.entry-content ul li,
.entry-content ol li {
  list-style-type: disc;
  margin: 8px 0 0 32px;
}

.entry-content ul ul,
.entry-content ul ol,
.entry-content ol ol,
.entry-content ol ul {
  margin-bottom: 0;
}

.entry-content dl {
  padding: 0;
}

.entry-content dl dt {
  font-size: 14px;
  font-weight: bold;
  font-style: italic;
  padding: 0;
  margin: 15px 0 5px;
}

.entry-content dl dt:first-child {
  padding: 0;
}

.entry-content dl dt> :first-child {
  margin-top: 0;
}

.entry-content dl dt> :last-child {
  margin-bottom: 0;
}

.entry-content dl dd {
  margin: 0 0 15px;
  padding: 0 15px;
}

.entry-content dl dd> :first-child {
  margin-top: 0;
}

.entry-content dl dd> :last-child {
  margin-bottom: 0;
}

.entry-content pre,
.entry-content code,
.entry-content tt {
  font-size: 15px;
  font-family: Consolas, 'Liberation Mono', Courier, monospace;
}

.entry-content code,
.entry-content tt {
  margin: 0 5px;
  padding: 2px;
  white-space: nowrap;
  color: #c7254e;
  background-color: #f9f2f4;
  border: 1px solid #eaeaea;
  border-radius: 3px;
}

.entry-content pre>code {
  margin: 0;
  padding: 0;
  white-space: pre;
  color: #333;
  border: none;
  background: transparent;
}

.entry-content pre {
  background-color: #f8f8f8;
  border: 1px solid #f9f9f9;
  line-height: 1.5rem;
  overflow: auto;
  padding: 6px 10px;
  border-radius: 3px;
}

.entry-content pre code,
.entry-content pre tt {
  background-color: transparent;
  border: none;
}

.entry-content blockquote {
  border-left: 4px solid #a0dad0;
  background-color: #ebeef5;
  border-radius: 3px;
  padding: 15px 20px;
  margin: 15px 0;
  color: #777;
}

.entry-content blockquote> :first-child {
  margin-top: 0;
}

.entry-content blockquote> :last-child {
  margin-bottom: 0;
}

.entry-content hr {
  margin: 24px 0;
  border: none;
  border-bottom: 1px solid #ddd;
  clear: both;
}

.entry-content table {
  margin: 0 auto;
}

.entry-content table th {
  font-weight: bold;
}

.entry-content table th,
.entry-content table td {
  border: 1px solid #ccc;
  padding: 6px 13px;
}

.entry-content table tr {
  border-top: 1px solid #ccc;
  background-color: #fff;
}

.entry-content table tr:nth-child(2n) {
  background-color: #f8f8f8;
}

.entry-content img {
  max-width: 100%;
}

.entry-content p {
  font-size: 16px;
  color: #4d4d4d;
  font-weight: 400;
  line-height: 26px;
}
</style>

<style scoped lang="less">
.site-content {
  position: relative;

  .site-main {
    padding: 80px 0 0 0;
  }
}

#article-menus {
  position: sticky;
  top: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  padding: 15px;
  width: 300px;
  transform: translateX(-120%) translateY(150px);
  font-size: 14px;
}

article.hentry {
  .entry-header {
    .entry-title {
      font-size: 23px;
      font-weight: 600;
      color: #737373;
      margin: 0.67em 0;

      &:before {
        content: '#';
        margin-right: 6px;
        color: #d82e16;
        font-size: 20px;
        font-weight: 600;
      }
    }

    hr {
      height: 1px;
      border: 0;
      background: #efefef;
      margin: 15px 0;
    }

    .breadcrumbs {
      font-size: 14px;
      color: #d2d2d2;
      text-decoration: none;
      margin-bottom: 30px;
    }
  }

  footer.post-footer {
    width: 100%;
    padding: 20px 10px;
    margin-top: 30px;
    height: 65px;
    position: relative;

    i {
      font-size: 18px;
      margin-right: 5px;
    }

    .post-like {
      float: right;
      margin: 7px 0 0 20px;
    }

    .post-share {
      float: right;
      list-style: none;
      margin-right: 20px;
    }

    .donate {
      float: left;
      line-height: 36px;
      border-radius: 100%;
      -webkit-border-radius: 100%;
      -moz-border-radius: 100%;
      border: 1px solid #2b2b2b;

      &:hover {
        border: 1px solid goldenrod;

        span {
          color: goldenrod;
        }
      }

      span {
        color: #2b2b2b;
        padding: 10px;
        position: relative;
        cursor: pointer;
      }

      .donate_inner {
        display: none;
        margin: 0;
        list-style: none;
        position: absolute;
        left: 80px;
        top: -40px;
        background: #fff;
        padding: 10px;
        border: 1px solid #ddd;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
        border-radius: 3px;

        &.show {
          display: block;
        }

        li {
          float: left;
        }

        img {
          width: 100px;
        }

        p {
          text-align: center;
          font-size: 15px;
          color: #d2d2d2;
          line-height: 1rem;
        }
      }

      .donate_inner:after,
      .donate_inner:before {
        content: '';
        position: absolute;
        left: 0;
        bottom: 45%;
        margin-left: -8px;
        border-top: 8px solid transparent;
        border-bottom: 8px solid transparent;
        border-right: 8px solid #fff;
      }

      .donate_inner:before {
        left: -1px;
        border-right: 8px solid #ddd;
      }
    }

    .post-tags {
      margin: 7px 0 0 20px;
      float: left;
      text-transform: uppercase;

      a:hover {
        color: #ff6d6d;
      }
    }
  }

  .open-message {
    margin: 50px 0;
    position: relative;
    background: #2b2b2b;
    padding: 10px 30px;
    border-radius: 3px;
    font-size: 14px;
    color: #fff;

    &:after {
      content: '';
      border-left: 10px solid transparent;
      border-right: 10px solid transparent;
      border-bottom: 10px solid #2b2b2b;
      position: absolute;
      top: -8px;
      left: 48%;
    }

    p {
      margin: 10px 0;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    a {
      color: #a0dad0;
      padding: 0 5px;
    }
  }
}

@media (max-width: 1490px) {
  #article-menus {
    display: none;
  }
}

@media (max-width: 800px) {
  #article-menus {
    display: none;
  }
}

#layout-header {
  position: relative;
  top: 0px;
  background: #e2e4e8;
  z-index: 9;
  width: 100%;
  height: 80px;
  padding: 0 80px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: 0.3s all ease;
  -webkit-transition: 0.3s all ease;
  -moz-transition: 0.3s all linear;
  -o-transition: 0.3s all ease;
  -ms-transition: 0.3s all ease;

  &.hidden {
    top: -100px;
  }

  &.fixed {
    background-color: #ffffff;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  }
}

.site-logo {
  text-align: center;

  img {
    width: 60px;
    height: 60px;
  }

  p.site-name {
    font-size: 15px;
    font-weight: bold;
    position: relative;
    top: -10px;
  }
}

.menus-btn {
  display: none;
  visibility: hidden;
}

.site-menus {
  display: flex;
  align-items: center;

  .menu-item {
    min-width: 60px;
    height: 50px;
    line-height: 50px;
    text-align: center;
    position: relative;

    a {
      padding: 12px 10px;
      color: #545454;
      font-weight: 500;
      font-size: 16px;

      &:hover {
        color: #ff6d6d;
      }
    }

    &:not(:last-child) {
      margin-right: 15px;
    }

    &.hasChild:hover .childMenu {
      opacity: 1;
      visibility: visible;
      transform: translateY(-5px);
    }
  }

  .childMenu {
    width: 130px;
    background-color: #fdfdfd;
    border-radius: 3px;
    border: 1px solid #ddd;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
    position: absolute;
    top: 55px;
    z-index: 2;
    opacity: 0;
    visibility: hidden;
    transition: 0.7s all ease;
    -webkit-transition: 0.6s all ease;
    -moz-transition: 0.6s all linear;
    -o-transition: 0.6s all ease;
    -ms-transition: 0.6s all ease;

    &:before,
    &:after {
      content: '';
      position: absolute;
      width: 0;
      height: 0;
      border-left: 6px solid transparent;
      border-right: 6px solid transparent;
      border-bottom: 8px solid white;
      top: -8px;
      left: 20px;
    }

    &:before {
      top: -9px;
      border-bottom: 8px solid #ddd;
    }

    .sub-menu {
      height: 40px;
      line-height: 40px;
      position: relative;

      &:not(:last-child):after {
        /*position: absolute;*/
        content: '';
        width: 50%;
        height: 1px;
        color: #ff6d6d;
        bottom: 0;
        left: 25%;
        z-index: 99;
      }
    }
  }
}

@media (max-width: 960px) {
  #layout-header {
    padding: 0 20px;
  }
}

@media (max-width: 600px) {
  #layout-header {
    padding: 0 10px;
  }

  .menus-btn {
    display: block;
    visibility: visible;
  }

  .site-menus {
    position: absolute;
    display: none;
    visibility: hidden;
    background-color: #f9f9f9;
    width: 100%;
    left: 0;
    top: 80px;
    z-index: -9;
    box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);

    .menu-item {
      position: relative;
      height: unset;

      &:not(:last-child) {
        margin-right: 0;
      }
    }

    .childMenu {
      position: relative;
      width: 100%;
      top: 0;
      background-color: #f3f3f3;
      opacity: 1;
      visibility: visible;
      border: none;
      box-shadow: none;

      &:before,
      &:after {
        content: '';
        position: relative;
        width: 0;
        height: 0;
        border-left: 0;
        border-right: 0;
        border-bottom: 0;
      }
    }
  }

  .site-menus.mobileShow {
    display: inline-block;
    visibility: visible;
    z-index: 99;
  }
}

.header-search {
  display: inline-block;
  position: relative;
  z-index: 999;

  i {
    font-size: 18px;
    position: relative;
    top: 3px;
  }

  input {
    border: none;
    outline: none;
    overflow: hidden;
    background: transparent;
    height: 30px;
    width: 0;
    transition: 0.2s all;

    &.show {
      width: 200px;
      margin-left: 10px;
    }

    &:focus {
      border-bottom: 1px solid #8fd0cc;
    }
  }
}

.example {
  text-align: center;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.05);
}

img {
  width: 780px;
  height: 520px;
}
</style>
